package com.ruoyi.warehouse.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.InOrderMapper;
import com.ruoyi.warehouse.domain.InOrder;
import com.ruoyi.warehouse.service.IInOrderService;

/**
 * 入库单Service业务层处理
 *
 * @author wujian
 * @date 2025-06-13
 */
@Service
public class InOrderServiceImpl implements IInOrderService
{
    @Autowired
    private InOrderMapper inOrderMapper;

    /**
     * 查询入库单
     *
     * @param orderNo 入库单主键
     * @return 入库单
     */
    @Override
    public InOrder selectInOrderByOrderNo(Long orderNo)
    {
        return inOrderMapper.selectInOrderByOrderNo(orderNo);
    }

    /**
     * 查询入库单列表
     *
     * @param inOrder 入库单
     * @return 入库单
     */
    @Override
    public List<InOrder> selectInOrderList(InOrder inOrder)
    {
        return inOrderMapper.selectInOrderList(inOrder);
    }

    /**
     * 新增入库单
     *
     * @param inOrder 入库单
     * @return 结果
     */
    @Override
    public int insertInOrder(InOrder inOrder)
    {
        inOrder.setCreateTime(DateUtils.getNowDate());
        return inOrderMapper.insertInOrder(inOrder);
    }

    /**
     * 修改入库单
     *
     * @param inOrder 入库单
     * @return 结果
     */
    @Override
    public int updateInOrder(InOrder inOrder)
    {
        inOrder.setUpdateTime(DateUtils.getNowDate());
        return inOrderMapper.updateInOrder(inOrder);
    }

    /**
     * 批量删除入库单
     *
     * @param orderNos 需要删除的入库单主键
     * @return 结果
     */
    @Override
    public int deleteInOrderByOrderNos(Long[] orderNos)
    {
        return inOrderMapper.deleteInOrderByOrderNos(orderNos);
    }

    /**
     * 删除入库单信息
     *
     * @param orderNo 入库单主键
     * @return 结果
     */
    @Override
    public int deleteInOrderByOrderNo(Long orderNo)
    {
        return inOrderMapper.deleteInOrderByOrderNo(orderNo);
    }
}
